package com.mjw.tender.util;

import cn.hutool.core.util.StrUtil;

import javax.servlet.http.HttpServletRequest;

public class TokenUtil {

    /**
     * 从requestHeader中获取token
     * @param request
     * @return
     */
    public static String getTokenFromReq(HttpServletRequest request){
        // 获取 token
        String Authorization = request.getHeaders("Authorization").nextElement().toString();
        String token = StrUtil.subAfter(Authorization," ",false);
        return token;
    }
}
